#!/usr/bin/env python
import sys

p_max = 1e9
if len(sys.argv)>1:
    p_max = int(sys.argv[1])

primes = [2, 3, ]
i = max(primes) +1
try:
	while i < p_max:
		cand = True
		for p in primes:
			if i % p == 0:
				cand = False
				#print i, 'divisible by', p
				break
		if cand: 
			primes.append(i)
			print i, 'is prime'
		
		i += 1
except KeyboardInterrupt:
	print primes
		
